package com.simple.javatraining.testing.testinside.questions;

import com.simple.javatraining.testing.io.InputOutput;
import com.simple.javatraining.testing.testinside.answers.Answer;
import com.simple.javatraining.testing.testinside.answers.ProposedAnswer;

import java.util.LinkedList;
import java.util.List;

public class QuestionWithYesNoAnswer extends Question{

public QuestionWithYesNoAnswer(String question, List<ProposedAnswer> answers) {
    super(question,answers);
}

public double checkUserAnswerForCorrect(Answer userAnswer) {
	List<ProposedAnswer> variantsOfAnswer =
            new LinkedList<ProposedAnswer>(this.getVariantsOfAnswer());
	double correspondenceTruth = 0d;
	for(Answer currentAnswer:variantsOfAnswer) {
		if (currentAnswer.getTextOfAnswer().equals(userAnswer.getTextOfAnswer())) {
			correspondenceTruth = 1d;
		}
	}
	return correspondenceTruth;
}

public void proposeVariantsOfAnswer() {}

public void printHint() {
    InputOutput.outputMessageToConsole("Укажите ответ в форме yes/no:");
}
}
